<header class="thredded--topic-header">
  <%= view_hooks.topic_page.title.render self, topic: topic do %>
    <h1 class="thredded--topic-header--title"><%= topic.title %></h1>
  <% end %>
  <cite class="thredded--topic-header--started-by">
    <%= t 'thredded.topics.started_by_html',
          time_ago: time_ago(topic.created_at),
          user:     user_link(topic.user) %>
  </cite>
  <% if topic.can_update? %>
    <%= link_to t('thredded.topics.edit'), topic.edit_path,
                class: 'thredded--topic-header--edit-topic',
                rel: 'nofollow' %>
  <% end %>
  <% if thredded_current_user %>
    <% if topic.followed? %>
      <div class="thredded--topic-header--follow-info">
        <span class="thredded--topic-header--follow-info--reason">
          <%= topic_follow_reason_text topic.follow_reason %>
        </span>
        <%= button_to topic.unfollow_path, form: {class: 'thredded--topic-header--follow-info--unfollow'} do %>
          <%= t('thredded.topics.unfollow') %>
          <%= inline_svg_tag 'thredded/follow.svg', class: 'thredded--topic-header--follow-icon' %>
        <% end %>
      </div>
    <% else %>
      <div class="thredded--topic-header--follow-info">
        <%= button_to t('thredded.topics.follow'), topic.follow_path,
                      form: {class: 'thredded--topic-header--follow-info--follow'} %>
      </div>
    <% end %>
  <% end %>
  <%= render partial: 'thredded/topics/followers', locals: {topic: topic} %>
</header>
